<template>
  <div>
    <el-row :key="todo.id">
      <el-col class="checkTextSty" :span="3"
        ><input
          type="checkbox"
          :checked="todo.done"
          @change="handleCheck(todo.id,todo.title,todo.price)"
      /></el-col>
      <el-col :span="5"
        ><span>{{ todo.id }}</span></el-col
      >
      <el-col :span="5">
        <img :src="'http://120.79.136.233:9898/queryFoodsPictureById/'+todo.id"/>
      </el-col>
      <el-col :span="5"
        ><span>{{ todo.title }}</span></el-col
      >
      <el-col :span="5"
        ><span>{{ todo.price }} ￥</span></el-col
      >
    </el-row>
    <hr />
  </div>
</template>

<script>
export default {
  name: "ConsumItem",
  props: ["todo", "checkTodo", "deleteTodo", "searchWord",'showFlag'],
  data() {
    return {
    };
  },
 
  methods: {
    //勾选or取消勾选
    handleCheck(id,title,money) {
      //通知userConsumption组件将对应的todo对象的done值取反
      this.checkTodo(id,title,money);

    },
  },
};
</script>

<style scoped>
/*item*/
li {
  list-style: none;
  height: 36px;
  line-height: 36px;
  padding: 0 5px;
  border-bottom: 1px solid #ddd;
}

img {
  width: 60px;
  height: 50px;
}

li button {
  float: right;
  display: none;
  margin-top: 3px;
}

li:before {
  content: initial;
}

li:last-child {
  border-bottom: none;
}

li:hover {
  background-color: #ddd;
}

li:hover button {
  display: block;
}
</style>